#ifndef ROBOT_H
#define ROBOT_H

#include <QTimer>
#include <QColor>
#include "socketbase.h"
#include "robotStructs.h"
#include "camera.h"
#include "stdlib.h"

/*

 */
class Robot : public SocketBase
{
    Q_OBJECT
private:
    QLabel *evalPositionLabel;
    QLabel *truePositionLabel;
    quint16 id;
    Camera *camera;
    QColor color;
    Kordinate* truePosition;
    ComandPkg packetToRead;
    ComandPkg packetToWrite;
public:
    Robot(quint16 id, QString host, quint16 port, Camera *camera, QObject *parent = 0);
    void sendStop();
    void sendDestination(quint16 x, quint16 y, quint16 theta);
    void sendGo();
    quint16 getId();
    QColor* getColor();
    void randomColor();
    Kordinate* getTruePosition();
    Kordinate* getEvalPosition();
    void setEvalPositionLabel(QLabel *evalPositionLabel);
    void setTruePositionLabel(QLabel *truePositionLabel);
    QString toString();
private:
    void updateTruePositionLabel();
    void writeCommand();
    void updateEvalPositionLabel();
private slots:
    void readData();
    void requestPosition();
    void sendPositions();
};

#endif // ROBOT_H
